home *** CD-ROM | disk | FTP | other *** search
/ Softwarová Záchrana 3 / Softwarova-zachrana-3.bin / Xteq X-Setup / xqdcXSP-Setup-EN.exe / {app} / plugins / XQ MSOXP MRU 1.xpl < prev    next >
Text File  |  2004-01-29  |  6KB  |  182 lines

  1. "FILE"="Xteq Systems X-Setup Plugin 6.0"
  2. "TYPE"="8"
  3. "COUNT"="3"
  4. "UIPATH"="Program Options\Microsoft Office\MS Office XP\Open/Save Dialog\Action MRU"
  5. "NAME"="Action MRU lists"
  6. "VERSION"="1.02"
  7. "LANGUAGE"="VBScript"
  8. "TEXT 1"="View..."
  9. "TEXT 2"="Clear MRU..."
  10. "TEXT 3"="CLEAR ALL"
  11. "DESCRIPTION 1"="When an Office program requests you about a filename to save or load, it will save this filename into a list called Most Recent Used (MRU). Basically, this list is the same as the "Documents" list inside your Start Menu but Office goes beyond a simple list."
  12. "DESCRIPTION 2"="In each program, you can perform several tasks with a file. For example, in Word you can either open a document which will ask you for a filename, but you can also enter a graphic file into your current document and thus you have two different actions "File Open" and "Insert Graphic"."
  13. "DESCRIPTION 3"="Each Office program can execute several actions and a most recent used files list is retained for each action. "
  14. "DESCRIPTION 4"="Simply select the program you are interested in and click on "View" to see the available actions and the associated files. "
  15. "DESCRIPTION 5"="Click on "Clear" to clear all linked files (MRU) for the selected application. Click on "Clear All" to clear ALL linked files in ALL MRUs in ALL found Office Programs."
  16. "DESCRIPTION 6"="Note: Clearing the MRU list does _NOT_ delete the files, the plug-in will simply remove the file "link" from the registry. Your files will of course not be deleted. "
  17. "AUTHOR"="Xteq Systems"
  18. "CONTACTURL"="http://www.xteq.com/"
  19. "COPYRIGHT"="Copyright ⌐ Xteq Systems - All Rights Reserved"
  20. "COMMENT 1"="see http://support.microsoft.com/?scid=312968"
  21.  
  22.  
  23. '*******************************************
  24. '* ORIGINAL FILE IS <XQ MSOXP MRU 1.xpl>  **
  25. '*******************************************
  26.  
  27.  
  28. sP_Check="HKCU\Software\Microsoft\Office\10.0\"
  29.       sP="HKCU\Software\Microsoft\Office\10.0\Common\Open Find\"
  30.  
  31. sV_Settings="\Settings\"
  32. sV_MRU="\File Name MRU\Value"
  33.  
  34. sV_MS="Microsoft"
  35.  
  36. Dim iCount
  37. Dim aryLoc()
  38.  
  39. Sub Plugin_Initialize 
  40.  if RegPathExists(sP_Check) then
  41.     Call RefreshDisplay()
  42.  else
  43.     Call Disable()
  44.  end if
  45. End Sub
  46.  
  47.  
  48. Sub Plugin_Apply(ElementIndex,ElementSubIndex)
  49.  if ElementSubIndex<0 then
  50.     Call MsgError("Please select an item first!")
  51.  else 
  52.     ESI=ElementSubIndex
  53.     sPrgName=aryLoc(ESI)
  54.     sTMPPath=sP & sPrgName & sV_Settings
  55.  
  56.     If ElementIndex=1 then
  57.        iCnt=RegEnumPaths(sTMPPath)
  58.        sMsg="The following files are saved for each action listed in the selected program. Please note that the listing of files will be stopped after three files, even if more exist." & chr(13) & chr(10) & chr(13) & chr(10)
  59.  
  60.        for l=1 to iCnt
  61.            sActionName=RegEnumElement(l) 
  62.  
  63.            'WHOEVER HAD THE IDEA OF THIS REGISTRY KEY: I HATE YOU !!!
  64.            sTMPPAth=sP & sPrgName & sV_Settings & sActionName & sV_MRU 
  65.           
  66.            'find some files in the current action
  67.            temp_ary=RegReadValue(sTMPPath)
  68.            sFiles=""
  69.                
  70.            if IsEmpty(temp_ary)=false then         
  71.               for e=lbound(temp_ary) to ubound(temp_ary)
  72.                   sFiles=sFiles & temp_ary(e) & "; "
  73.                   if e=2 then exit for
  74.               next
  75.            end if
  76.  
  77.            if len(sfiles)=0 then
  78.               sFiles="No Files"
  79.            else 
  80.               sFiles="(Files: " & sFiles & ")"
  81.            end if
  82.  
  83.            sMsg = sMsg & "[" & sActionName & "] " & sFiles & chr(13) & chr(10)                    
  84.        next 
  85.  
  86.        Call MsgInformation(sMsg)
  87.     end if
  88.  
  89.  
  90.     'KILL ONE MRU!  
  91.     If ElementIndex=2 then
  92.        Call TrashMRUEntries(sTMPPath,sPrgName)
  93.  
  94.        Call MsgInformation("File entries removed, please click the View button to check the changes.") 
  95.        'Call RefreshDisplay
  96.    end if     
  97.  end if
  98.  
  99.  
  100.  'for clear all, the user does not need to have an item selected
  101.  
  102.  '---CLEAR ALL !!!! ----
  103.  If ElementIndex=3 then
  104.     sReturn=InputWindow("Are you really sure you want to clear MRU entires? If so, please enter YES and click OK.","YES",1) 
  105.     if IsEmpty(sReturn)=false then
  106.  
  107.        for l=lbound(aryLoc) to ubound(aryLoc)
  108.            sPrgName=aryLoc(l)
  109.            sTMPPath=sP & sPrgName & sV_Settings
  110.  
  111.            if EntryIsOfficePrg(sPrgName) then
  112.               'okay, this is a program
  113.               Call TrashMRUEntries(sTMPPath,sPrgName)
  114.            end if
  115.        next 
  116.  
  117.        Call MsgInformation("All file entries removed, please click the View button to check the changes.") 
  118.  
  119.     end if
  120.  end if
  121.  
  122.  
  123.  
  124. End Sub
  125.  
  126.  
  127. Sub RefreshDisplay
  128.  For l=1 to iCount
  129.      Call SetUIElement(l,"")
  130.  next
  131.  
  132.  iCount=RegEnumPaths(sP)
  133.  
  134.  if iCount>0 then
  135.     'redim array
  136.     ReDim aryLoc(iCount)
  137.  
  138.     for l=1 to iCount
  139.         s=RegEnumElement(l)
  140.         aryLoc(l)=s
  141.     next
  142.  
  143.     for l=lbound(aryLoc) to ubound(aryLoc)
  144.         s=aryLoc(l)
  145.  
  146.         if EntryIsOfficePrg(s) then
  147.            'okay, this is a program
  148.            sTMPPath=sP & s & sV_Settings
  149.            iCntActions=RegEnumPaths(sTMPPath)
  150.  
  151.            Call SetUIElement(l,s & " (" & CStr(iCntActions) & " actions)")        
  152.         end if
  153.     next 
  154.  end if
  155. End Sub
  156.  
  157. Function EntryIsOfficePrg(RegEntryName)
  158.  if ucase(left(RegEntryName,len(sV_MS)))=ucase(sV_MS) then
  159.     EntryIsOfficePrg=true
  160.  else
  161.     EntryIsOfficePrg=false
  162.  end if
  163. End Function
  164.  
  165.  
  166. Sub TrashMRUEntries(TMP_Path,PRG_NAME)
  167.     iCnt=RegEnumPaths(TMP_Path)
  168.  
  169.     for l=1 to iCnt
  170.         sActionName=RegEnumElement(l) 
  171.         sTMPPAth=sP & PRG_Name & sV_Settings & sActionName & sV_MRU 
  172.  
  173.         if RegValueExists(sTMPPath) then
  174.            Call RegDeleteValue(sTMPPath)
  175.         end if
  176.      next
  177. End Sub
  178.  
  179.  
  180. Sub Plugin_Terminate 
  181. End Sub
  182.